package com.cloudfun.campusshare.configuration.property;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Created by Huqin on 2020/4/16
 */
@Data
@Component
@ConfigurationProperties(prefix = "wechat")
public class WeChatProperties implements InitializingBean {

    private String appId;

    private String secret;

    private String apiKey;

    private String mchId;
    @Override
    public void afterPropertiesSet() throws Exception {
        if (StringUtils.isBlank(appId) || StringUtils.isBlank(secret) || StringUtils.isBlank(apiKey)) {
            throw new RuntimeException("微信配置异常，请检查配置");
        }
    }
}
